<template>
	<view class="goods_list">
		<view class="goods_item" v-for="(item,index) in goods" :key="index" @tap="Navigate(item.id,item.space_id)" @longpress="itemDelete(item.id)">
			<image :src= 'getImgSrc(item.logo,baseUrl)' mode="aspectFill"></image>
			<view class="name">{{item.title}}</view>
			<view class="space">{{item.space_title}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['goods','baseUrl'],
		methods: {
			Navigate(id,space_id) {
				this.$emit('goodsItemClick',id,space_id)
			},
			itemDelete(id) {
				this.$emit('goodsDelete',id)
			},
			getImgSrc(url,baseUrl){
				//console.log(url)
				if(url =='' || url == null){
					return '/static/noimage.jpg'
				}
				else{
					return baseUrl + url
				}
			}
			
		}
	}
</script>

<style lang="scss">
	.goods_list {
		margin: 0 10rpx;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;

		.goods_item {
			background: #fff;
			width: 350rpx;
			margin: 10rpx 0;

			image {
				width: 90%;
				height: 170px;
				display: block;
				margin: auto;
			}

			.space {
				font-size: 30rpx;
				line-height: 50rpx;
				padding-top: 10rpx;
				padding-bottom: 15rpx;
			}
		}
	}
</style>
